home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / BBS-Archive / DiskUtil / Crunch / XFH.lha / XFH / SRC / PACKFUNC.C < prev    next >
C/C++ Source or Header  |  1994-04-15  |  4KB  |  122 lines

  1. /* packfunc.c - declaration of packertype interface.
  2.    Copyright (C) 1991, 1992, 1993 Kristian Nielsen.
  3.  
  4.    This file is part of XFH, the compressing file system handler.
  5.  
  6.    This program is free software; you can redistribute it and/or modify
  7.    it under the terms of the GNU General Public License as published by
  8.    the Free Software Foundation; either version 2 of the License, or
  9.    (at your option) any later version.
  10.  
  11.    This program is distributed in the hope that it will be useful,
  12.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.    GNU General Public License for more details.
  15.  
  16.    You should have received a copy of the GNU General Public License
  17.    along with this program; if not, write to the Free Software
  18.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.            */
  19.  
  20. #include "CFS.h"
  21.  
  22. /* The struct cfsfunctions interface to the rest of the file system. */
  23.  
  24. /* In order to inhibit warnings about incompatible pointer assigns, the */
  25. /* macro '_' is defined to be a cast to void *. */
  26.  
  27. #define _ (void *)
  28.  
  29. /* Xpk.library support. */
  30. struct cfsfunctions Xpkfunc = {
  31.   _ owt,           /* Cannot Open() from XpkLock (is a plain file). */
  32.   _ Xpk_Read,      /* Read() */
  33.   _ Xpk_Write,     /* Write() */
  34.   _ Xpk_Seek,      /* Seek() */
  35.   _ Xpk_Close,     /* Close() */
  36.   _ ank,           /* SetFileSize() */
  37.   _ ank,           /* LockRecord() */
  38.   _ ank,           /* UnLockRecord() */
  39.   _ owt,           /* Lock() */
  40.   _ XpkDupLock,    /* DupLock() */
  41.   _ XpkUnLock,     /* UnLock() */
  42.   _ XpkObjExamine, /* Examine() */
  43.   _ owt,           /* ExNext() */
  44.   _ owt,           /* CreateDir() */
  45.   _ owt,           /* DeleteFile() */
  46.   _ owt,           /* Rename() */
  47.   _ XpkParentDir,  /* Parent() */
  48.   _ owt,           /* SetProtection() */
  49.   _ owt,           /* SetComment() */
  50.   _ owt,           /* SetFileDate() */
  51.   _ ank,           /* OpenFromLock() */
  52.   _ XpkSameLock,   /* SameLock() */
  53.   _ owt,           /* MakeLink() */
  54.   _ owt,           /* ReadLink() */
  55.   _ ank,           /* ChangeMode() */
  56.   _ ank,           /* DupLockFromFH() */
  57.   _ XpkParentFH,   /* ParentOfFH() */
  58.   _ owt,           /* ExAll() */
  59.   _ XpkObjExamineFH, /* ExamineFH() */
  60.   _ NULL,          /* StartNotify() */
  61.   _ NULL,          /* EndNotify() */
  62. };
  63.  
  64.  
  65. /* XObj support (underlying file system). */
  66. struct cfsfunctions Xfunc = {
  67.   _ owt,           /* Cannot Open() from XObjLock. */
  68.   _ XObjRead,      /* Read() */
  69.   _ XObjWrite,     /* Write() */
  70.   _ XObjSeek,      /* Seek() */
  71.   _ XObjClose,     /* Close() */
  72.   _ ank,           /* SetFileSize() */
  73.   _ ank,           /* LockRecord() */
  74.   _ ank,           /* UnLockRecord() */
  75.   _ owt,           /* Lock() */
  76.   _ XObjDupLock,   /* DupLock() */
  77.   _ XObjUnLock,    /* UnLock() */
  78.   _ XObjExamine,   /* Examine() */
  79.   _ XObjExNext,    /* ExNext() */
  80.   _ XObjCreateDir, /* CreateDir() */
  81.   _ XObjDeleteFile, /* DeleteFile() */
  82.   _ XObjRename,    /* Rename() */
  83.   _ XObjParentDir, /* Parent() */
  84.   _ XObjSetProtection, /* SetProtection() */
  85.   _ XObjSetComment,  /* SetComment() */
  86.   _ XObjSetFileDate, /* SetFileDate() */
  87.   _ ank,           /* OpenFromLock() */
  88.   _ XObjSameLock,  /* SameLock() */
  89.   _ XObjMakeLink,  /* MakeLink() */
  90.   _ XObjReadLink,  /* ReadLink() */
  91.   _ ank,           /* ChangeMode() */
  92.   _ ank,           /* DupLockFromFH() */
  93.   _ XObjParentFH,  /* ParentOfFH() */
  94.   _ owt,           /* ExAll() */
  95.   _ XObjExamineFH, /* ExamineFH() */
  96.   _ NULL,          /* StartNotify() */
  97.   _ NULL,          /* EndNotify() */
  98. };
  99.  
  100. #undef _
  101.  
  102.  
  103. /* This function is called to fix the FIB to correctly reflect the */
  104. /* result of unpacking the file (or archive). */
  105. BOOL ModifyFIB_type( glb glob, LONG type, struct CFSLock *lock,
  106.             struct FileInfoBlock *fib, struct FileHandle *xfh ){
  107.   
  108.   switch(type){
  109.   case XOBJECT:
  110.     return XObjModifyFIB( glob, lock, fib, xfh );
  111.   case XPKOBJECT:
  112.     return XpkModifyFIB( glob, (struct XpkLock *)lock, fib, xfh );
  113.   default:
  114.     debug(("Error: ModifyFIB_type(): Bad object type %ld\n",type));
  115.     glob->ioerr = ERROR_ACTION_NOT_KNOWN;
  116.     return DOSFALSE;
  117.   }
  118. }
  119.  
  120.  
  121. /* End of packfunc.c */
  122.